package com.example.airobotinterviewrecord.entity.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

@Getter
public enum InterviewTypeEnum {
    DIGITAL(1, "数字人面试"),
    HUMAN(2, "人工面试"),
    HYBRID(3, "混合面试");

    @EnumValue  // 标记存入数据库的字段
    private final int code;
    private final String desc;

    InterviewTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    // 根据code获取枚举
    @JsonCreator
    public static InterviewTypeEnum fromCode(int code) {
        for (InterviewTypeEnum type : values()) {
            if (type.code == code) {
                return type;
            }
        }
        throw new IllegalArgumentException("无效的面试类型编码: " + code);
    }
    @JsonValue
    public String getDesc() {
        return desc;
    }
}